import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'

// https://vite.dev/config/



// https://vite.dev/config/
export default defineConfig({
  //   css:{
  // postcss:{
  //   plugins:[
  //    postcss({
  //     rootValue({file}){
  //          return file.indexOf('vant') !== -1 ? 37.5 : 75;
  //     },
  //      propList: ['*'],
  //      selectorBlacklist: ['']
  //    })
  //   ]
  // }
  //   }, 

  //   },
  //   css:{
  // postcss:{
  //   plugins:[
  //    postcss({
  //     rootValue({file}){
  //          return file.indexOf('vant') !== -1 ? 37.5 : 75;
  //     },
  //      propList: ['*'],
  //      selectorBlacklist: ['']
  //    })
  //   ]
  // }
  //   },

  plugins: [
    vue(),
    AutoImport({
      resolvers: [ElementPlusResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver()],
    }),
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),

    },
  },
  server: {
    proxy: {
      //春雨医生登陆注册接口
      '/api': {
        target: 'http://124.221.74.149:8011',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ''),
      },
      //春雨医生主页接口
      '/static': {
        target: 'https://www.chunyuyisheng.com',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/static/, ''),
      },
      '/newapi': {
        target: 'http://localhost:8000',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/newapi/, ''),
      },
      //春雨数地址据接口
      '/addres': {
        target: 'http://192.168.8.5:8000',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/addres/, ''),
      },
      //组长春雨数据接口
      '/chunyu': {
        target: 'http://192.168.199.80:9000/users',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/chunyu/, ''),
      },
      //龙的后台接口
      '/app': {
        target: 'http://localhost:3000',
        rewrite: (path) => path.replace(/^\/app/, ''),
      },
    },
  },
})



      
